package com.kaiwukj.android.ufamily;

import androidx.test.ext.junit.runners.AndroidJUnit4;

import com.blankj.utilcode.util.LogUtils;
import com.zghl.mclient.client.ZghlMClient;
import com.zghl.mclient.client.ZghlMqttListener;
import com.zghl.mclient.client.ZghlStateListener;

import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public class ZghlTest {

    @Test
    public void testLogin() {
        ZghlMClient.getInstance().login("17770821515", new ZghlStateListener() {
            @Override
            public void onSuccess(int i, String s) {
                LogUtils.d("onSuccess-------------------->" + i);
            }

            @Override
            public void onError(int i, String s) {
                LogUtils.d("onError-------------------->" + i);
            }
        });
    }

    @Test
    public void testConn() {
        ZghlMqttListener zghlMqttListener = new ZghlMqttListener() {
            @Override
            public void onReceiveMessage(String type, String msg) {
                LogUtils.d("onReceiveMessage---------------->" + msg + ":" + type);
            }

            @Override
            public void onConnectionStateChange(boolean b, String s) {
                LogUtils.d("onConnectionStateChange---------------->" + b + ":" + s);
            }

        };

        ZghlMClient.getInstance().setMqttListener(zghlMqttListener);
    }

}
